home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / utility / utilcli / mscclcmd.lha / GetDate.doc < prev    next >
Text File  |  1996-09-23  |  4KB  |  131 lines

  1. GetDate V1.0 by Chris Hodges
  2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3.  
  4. Introduction
  5. ~~~~~~~~~~~~
  6. This little command allows extracting of more specific date data  than  the
  7. original  date  command  does.  Can  be quite useful for comparing dates in
  8. batch scripts etc.
  9.  
  10. Requirements
  11. ~~~~~~~~~~~~
  12. GetDate needs Kick 2.04 or higher.
  13.  
  14. Usage
  15. ~~~~~
  16. GetDate [FILE filename] [TIME] [WEEKDAY] [INTERNATIONAL=INT|USA]
  17. GetDate [FILE filename] [NUM] [DAYONLY|MONTHONLY|YEARONLY|WEEKDAYONLY]
  18. GetDate [FILE filename] [NUM] [TIMEONLY|HOURSONLY|MINSONLY|SECSONLY]
  19.  
  20. Full template:
  21.  
  22. FILE/K,TIME/S,WEEKDAY=WD/S,NUMERIC=NUM/S,INTERNATIONAL=INT/S,USA/S,
  23. DAYONLY=DO/S,MONTHONLY=MO/S,YEARONLY=YO/S,WEEKDAYONLY=WDO/S,TIMEONLY=TO/S,
  24. HOURSONLY=HO/S,MINSONLY=MIO/S,SECSONLY=SO/S.
  25.  
  26. FILE/K:
  27. If this keyword is given the date will be taken  from  the  given  file  or
  28. directory, otherwise the current date will be used.
  29.  
  30. TIME/S:
  31. Prints out the time aswell if this switch given. If you only  want  to  get
  32. the time stamp, use TIMEONLY keyword.
  33.  
  34. WEEKDAY=WD/S:
  35. Normally, the week day is ommitted. Use this switch to turn it on.
  36.  
  37. NUMERIC=NUM/S:
  38. Normally, the date is returned as readable ascii string. The  use  of  this
  39. switch  will print out the date as number of days since 01-Jan-78. This can
  40. be useful for scripts, e.g if you want to find out, how much  days  a  file
  41. has  not  been  touched. It has futher effect when used in conjunction with
  42. the MONTHONLY, WEEKDAYONLY and TIMEONLY options.
  43.  
  44. INTERNATIONAL=INT/S:
  45. Normally, the date string is created in the way AmigaDOS does  (dd-mmm-yy).
  46. This  toggle switches to international date syntax (yy-mmm-dd). INT and USA
  47. are mutually exclusive.
  48.  
  49. USA/S:
  50. Normally, the date string is created in the way AmigaDOS does  (dd-mmm-yy).
  51. This  toggle  switches  to american date syntax (mm-dd-yy). USA and INT are
  52. mutually exclusive.
  53.  
  54. The following options are all mutually exclusive:
  55.  
  56. DAYONLY=DO/S:
  57. If specified, GetDate only returns the day of the month.
  58.  
  59. MONTHONLY=MO/S:
  60. If specified, only the name of the month is returned. If the NUM option  is
  61. also used, the number of the month will be returned instead.
  62.  
  63. YEARONLY=YO/S:
  64. If specified, only the year will be returned.
  65.  
  66. WEEKDAYONLY=WDO/S:
  67. Returns the name of the current day, if specified. If  the  NUM  option  is
  68. also  used,  a  number from 1 (Monday) to 7 (Sunday) is returned. You don't
  69. have to use the WEEKDAY switch in conjunction with WEEKDAYONLY.
  70.  
  71. TIMEONLY=TO/S:
  72. Only returns a time string if specified. If the  NUM  option  is  given,  a
  73. number  is  returned  which  represents  the amount of minutes passed since
  74. midnight. You don't have to use the TIME switch.
  75.  
  76. HOURSONLY=HO/S:
  77. Returns the hours of the day, if specified.
  78.  
  79. MINSONLY=MIO/S:
  80. Returns the  number  of  minutes  passed  since  the  last  full  hour,  if
  81. specified.
  82.  
  83. SECSONLY=SO/S:
  84. Returns the number of seconds in the current minute.
  85.  
  86. Examples
  87. ~~~~~~~~
  88. 1. Checks if the internal  clock  is  going  wrong  (due  to  some  program
  89.    overwriting  the  data  and  demanding correction  by the user. Place in
  90.    user-startup.
  91.  
  92. If NOT EXISTS ENVARC:LastBootDate
  93.   GetDate >ENVARC:LastBootDate NUM
  94. Else
  95.   GetDate >ENV:CurBootDate NUM
  96.   Eval >ENV:Result $CurBootDate-$LastBootDate
  97.   If VAL 100 GT $Result
  98.     If VAL 0 GT $Result
  99.       SYS:Prefs/Time
  100.     EndIf
  101.   Else
  102.     SYS:Prefs/Time
  103.   EndIf
  104.   Copy ENV:CurBootDate ENVARC:LastBootDate
  105.   Delete >NIL: ENV:Result ENV:CurBootDate
  106. EndIf
  107.  
  108. 2. Imagine you're using a timer to make a call to a bss from about 2  to  3
  109.    o'clock in the night. You can use this one to check if it's that late:
  110.  
  111. GetDate >ENV:Hour HOURSONLY
  112. If VAL $Hour EQ 2
  113.   S:AutoNetcall
  114. EndIf
  115.  
  116. History
  117. ~~~~~~~
  118. V1.0 (23-Sep-96): First release.
  119.  
  120. Contact address
  121. ~~~~~~~~~~~~~~~
  122. Any mails or donations to:
  123.  
  124. Chris Hodges                    Account: 359 68 63
  125. Kennedystr. 8                   BLZ    : 700 530 70
  126. D-82178 Puchheim                Bank   : Sparkasse Fürstenfeldbruck
  127. Germany
  128. Tel.: +49-89/8005856
  129. Email: chris@sixpack.pfalz.de
  130.  
  131.